# Maintainer: Andy Postnikov <apostnikov@gmail.com>
pkgname=php83-pecl-zstd
_extname=zstd
pkgver=0.13.1
pkgrel=0
pkgdesc="PHP 8.3 Zstandard extension - PECL"
url="https://pecl.php.net/package/zstd"
arch="all"
license="MIT"
_phpv=83
_php=php$_phpv
depends="$_php-common"
makedepends="$_php-dev $_php-pecl-apcu zstd-dev"
checkdepends="$_php-openssl"
source="php-pecl-$_extname-$pkgver.tgz::https://pecl.php.net/get/$_extname-$pkgver.tgz"
builddir="$srcdir/$_extname-$pkgver"

build() {
	phpize$_phpv
	./configure --prefix=/usr --with-php-config=php-config$_phpv --with-libzstd
	make
}

check() {
	local _modules=/usr/lib/$_php/modules
	make NO_INTERACTION=1 REPORT_EXIT_STATUS=1 test PHP_TEST_SHARED_EXTENSIONS=" \
		-d extension=$_modules/apcu.so \
		-d extension=$_modules/openssl.so \
		-d extension=modules/$_extname.so" TESTS=--show-diff
}

package() {
	make INSTALL_ROOT="$pkgdir" install
	local _confdir="$pkgdir"/etc/$_php/conf.d
	install -d $_confdir
	echo "extension=$_extname" > $_confdir/$_extname.ini
}

sha512sums="
c6c8f2f249d101a052b9122d45131bf65f905b4d9cdb77f1a3cd7949861fad03801d0fb600d84d0eaf9bb0d21a836c50602b2c362de7fda32a79e6510ff0b5a7  php-pecl-zstd-0.13.1.tgz
"
